package com.wu.llpsw.yuanli.energy;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import net.minecraftforge.common.util.INBTSerializable;

/**
 * 能量的本体类
 */
public class power implements INBTSerializable {
    private int maxPower;//最大元力值
    private int nowPower;//当前元力值

    public power(){
        this.maxPower=1;
        this.nowPower=1;
    }
    @Override
    public CompoundTag serializeNBT() {
        CompoundTag nbt=new CompoundTag();
        nbt.putInt("max",maxPower);
        nbt.putInt("now",nowPower);
        return nbt;
    }


    @Override
    public void deserializeNBT(Tag inbt) {
        if(inbt instanceof CompoundTag){
            CompoundTag nbt=(CompoundTag) inbt;
            this.maxPower=nbt.getInt("max");
            this.nowPower=nbt.getInt("now");
        }
    }

    public int getMaxPower() {
        return maxPower;
    }

    public void setMaxPower(int maxPower) {
        this.maxPower = maxPower;
    }

    public int getNowPower() {
        return nowPower;
    }

    public void setNowPower(int nowPower) {
        this.nowPower = nowPower;
    }
}
